//index.js
//获取应用实例

const app = getApp()
const date = new Date()
const provinceList = []
const letterList = []

var wxMarkerData = [];
for (let i = 1990; i <= date.getFullYear(); i++) {
  provinceList.push(i)
}

for (let i = 1; i <= 12; i++) {
  letterList.push(i)
}


Page({

  data: {
    menuList: [
      { id: 1, on: true, text: '备案登记', imgclass: 'iconfont icon-order;', url: '/page-registration/home' },
      // { id: 2, on: true, text: '操作证', imgclass: 'iconfont icon-businesscard', url: '/page-operation/operation' },
      // { id: 3, on: false, text: '评估服务', imgclass: 'iconfont icon-xunjianjianyan', url: '/page-search/search' },
      // { id: 4, on: false, text: '法律留言', imgclass: 'iconfont icon-danju-xianxing', url: '/page-law/law' },
      // { id: 5, on: false, text: '保险服务', imgclass: 'iconfont icon--fuwu', url: '' },
      // { id: 6, on: false, text: '设备租赁', imgclass: 'iconfont icon-dianpu', url: ' ' },
      // { id: 7, on: false, text: '零售配件', imgclass: 'iconfont icon-shezhi-xianxing', url: ' ' },
      // { id: 8, on: false, text: '修理服务', imgclass: 'iconfont icon-anzhuangshigong', url: ' ' },
      // { id: 9, on: false, text: '应急救援', imgclass: 'iconfont icon-touchengkongyun', url: ' ' },
    ],


    sliderList: [

      // {
      //   selected: false, imageSource:
      //   'https://api.gcjxglzx.com/images/yizhong-wechat/videos/homePage.mp4', stype: false
      // },
      // 首页显示的广告照片，暂时取消
      { selected: true, imageSource: 'https://api.gcjxglzx.com/images/yizhong-wechat/background-img/advertisement3.png', stype: true },
      { selected: false, imageSource: 'https://api.gcjxglzx.com/images/yizhong-wechat/background-img/advertisement1.jpg', stype: true },
      { selected: false, imageSource: 'https://api.gcjxglzx.com/images/yizhong-wechat/background-img/advertisement4.png', stype: true },
      { selected: false, imageSource: 'https://api.gcjxglzx.com/images/yizhong-wechat/background-img/advertisement5.png', stype: true },

    ],
    newList: app.globalData.newList,
    adminPhone: '‭04722551124‬',
    markers: [],

  },
  toastNoTap: function () {
    wx.showToast({
      title: "此功能暂未上线",
      icon: "loading",
      duration: 1000
    })
  },

  bindTelPhone: function (e) {
    var that = this
    wx.makePhoneCall({
      phoneNumber: that.data.adminPhone,
      success: function () {
        console.log("成功拨打电话")
      }
    })
  },
  onReady: function () {
    wx.hideTabBar()
    var that = this;

    wx.request({
      url: app.globalData.newsRequestUrl + "/f/information/listByPage",
      header: {
        'content-type': 'application/json' // 默认值
      },
      method: "POST",
      data: {
        "page": "1", "rows": "10"
      },
      success: function (result) {
        that.setData({
          newList: result.data.detail.list
        })
        app.globalData.newList = result.data.detail.list;

        console.log('request success', app.globalData.newList)
      },
      fail: function ({ errMsg }) {
        console.log('request fail', errMsg)

      }
    })
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },


  onShareAppMessage: function () {

  }
})



